package huoye.shops.huoye.operation.presenter;


import com.codeideology.android.lang.entity.Paging;

import java.util.List;

import huoye.shops.base.BasePresenter;
import huoye.shops.base.MineBaseJsonRequestCallback;
import huoye.shops.huoye.operation.model.DiscountCancelData;
import huoye.shops.huoye.operation.model.QueueShopData;
import huoye.shops.huoye.operation.networt.OperationService;
import huoye.shops.huoye.operation.view.IPrizeCancelRefreshView;
import huoye.shops.huoye.operation.view.IQueueShopRefreshView;

/**
 * Created by uesr on 2017/7/19.
 */

public class QueueShopPresenter extends BasePresenter<IQueueShopRefreshView> {

  private OperationService mService;

    //排队商家接口
    public void getShopQueueList(int mType,String eventId,final Paging paging){
        mService.getShopQueueList(mType,eventId,paging, new MineBaseJsonRequestCallback<QueueShopData>(QueueShopData.class) {

            @Override
            public void onSuccess(QueueShopData queueShopData) {
                super.onSuccess(queueShopData);
                view.setDataSet(queueShopData.getQueueShops(),new Paging());
            }

            //网络请求失败
            @Override
            public void onFailure(String msg, String code, Throwable e) {
                super.onFailure(msg, code, e);
                view.makeToast(msg);
            }

            //加载结束
            @Override
            public void onNetworkFail() {
                super.onNetworkFail();
                view.onNetworkFail();
            }

            //加载中
            @Override
            public void onFinish() {
                super.onFinish();
                view.hideProcessingIndicator();
            }
        });
    }


    @Override
    public void onStart() {
        mService = new OperationService();
    }
}
